<!-- 主体名称表 -->
<template>
    <div>
        <el-form :inline="true">
            <el-form-item label="主体名称：">
                <el-input v-model="form.name" placeholder="请输入主体名称"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="searchList(1)" id="monitorEnter">查询</el-button>
            </el-form-item>
        </el-form>
        <el-table :data="tableData" border stripe style="margin:20px 0;" @row-click="getCompanyItem">
            <el-table-column label="序号" type="index" align="center" width="55"></el-table-column>
            <el-table-column label=""  align="center" width="55">
                    <template slot-scope="scope">
                            <el-radio class="radio"  v-model="selectradio"  :label="scope.$index">&nbsp;</el-radio>
                    </template>
            </el-table-column>
            <el-table-column :label="inBoleName" prop="inBole" align="center" ></el-table-column>
            <el-table-column :label="inBoleTaxpayer" prop="inBoleTaxpayer" align="center" ></el-table-column>
            <el-table-column label="公司地址" prop="address" align="center" :width="300" ></el-table-column>
            <el-table-column label="邮政编码" prop="postalcode" align="center" :width="100"></el-table-column>
            <el-table-column label="联系电话" prop="phone" align="center" ></el-table-column>
        </el-table>
        <el-pagination
            layout="total, sizes, prev, pager, next, jumper"
            style="margin-top:30px"
            :current-page.sync="pageNum"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="pageSize"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :total="totalSize">
        </el-pagination>
    </div>
</template>
<script>
import api from '@/api/apiPath'
import tableList from '../common/tableList'
export default {
	components: {
        'table-list':tableList,
        },
	data () {
		return {
            selectradio:'',
            seleArray:[],
            tableInfos:[
                {label:'公司名称',prop:'inBole'},
                {label:'纳税人识别号',prop:'inBoleTaxpayer'},
                {label:'公司地址',prop:'address'},
                {label:'邮政编号',prop:'postalcode'},
                {label:'联系电话',prop:'phone'},
            ],
           
            tableData:[],
            pageNum: 1,
            pageSize: 10,//每页几条
            totalSize: 0,
        }
    },
    computed:{
        inBoleName(){
            if(this.type===1){
                return '公司名称/姓名'
            }else{
                return '公司名称'
            }
        },
        inBoleTaxpayer(){
            if(this.type===1){
                return '纳税人识别号/身份证号'
            }else{
                return '纳税人识别号'
            }
        }

    },
    methods:{
        getCompanyItem(row){
            this.selectradio = this.tableData.indexOf(row)
            this.$emit('selectChange',row);
        },
        searchList(pageNum){
            let param = {
                pageNum:pageNum||this.pageNum,
                pageSize:this.pageSize,
                type:this.type,
                name:this.form.name,

            };
            if((!this.type && this.type !==0) || this.type === 3) return ;
            this.axios.post(api.getContractUndersign, param).then(res => {
                if (res.data.code == 200) {
                    let list = res.data.data.list || [];
                    
                    this.tableData = list;
                    this.totalSize = res.data.data.total;
                }
            })
            
        },
        handleCurrentChange () {
            this.searchList()
		},
		handleSizeChange (val) {
			this.pageSize = val
			this.searchList()
        },
        handleClose(){

        },
    },
    props:['type','form'],
    watch:{
        type(){
            this.form.name='';
            this.selectradio ='',
            this.$emit('selectChange','');
            this.tableData = [];
            this.searchList(1);
        }
    },
	created () {
        this.searchList();
    },
	destroyed() {
		
	},
	filters: {

	}
}

</script>

<style lang="stylus" scoped>


</style>
